import { MatIconRegistry } from '@angular/material'; // 注册svg字体图标
import { DomSanitizer } from '@angular/platform-browser';
// 封装使用外部svg资源的工具类
export const loadSvgResources = (ir: MatIconRegistry, ds: DomSanitizer) => {
    const imgDir = 'assets/images';
    const sidebarDir = `${imgDir}/sidebar`;
    const dayDir = `${imgDir}/days`;
    const avatorDir = `${imgDir}/avator`;
    ir.addSvgIcon('project', ds.bypassSecurityTrustResourceUrl(`${imgDir}/m.svg`));
    ir.addSvgIcon('m', ds.bypassSecurityTrustResourceUrl(`${imgDir}/m.svg`));
    ir.addSvgIcon('w', ds.bypassSecurityTrustResourceUrl(`${imgDir}/w.svg`));
    ir.addSvgIconSetInNamespace('avators', ds.bypassSecurityTrustResourceUrl(`${avatorDir}/sprite.svg`));

    const days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
    days.forEach(d => ir.addSvgIcon(`day${d}`, ds.bypassSecurityTrustResourceUrl(`${dayDir}/day${d}.svg`)));
};
